import React from "react";
import { Input } from "antd";
import "styles/components/compact-input.scss";

const InputGroup = Input.Group;

function CompactInput({ className = "", style = {}, children }) {
  return children && Array.isArray(children) && children.length === 2 ? (
    <InputGroup compact className={`compact-input ${className}`} style={style}>
      <div className="compact-input-prev">{children[0]}</div>
      <div className="compact-input-next">{children[1]}</div>
    </InputGroup>
  ) : null;
}

export default CompactInput;
